package com.zyx.xxl.executor.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;

/**
 * @author Yaxi.Zhang
 * @since 2022/6/13 17:52
 * desc:
 */
public class TimeUtil {
    private static final SimpleDateFormat sdf = new SimpleDateFormat("ss mm HH dd MM ? yyyy");
    /**
     *  功能描述：日期转换cron表达式
     */
    public static String formatDateByPattern(Date date) {
        String formatTimeStr = null;
        if (Objects.nonNull(date)) {
            formatTimeStr = sdf.format(date);
        }
        return formatTimeStr;
    }

    public static void main(String[] args) {
        System.out.println(formatDateByPattern(new Date()));
    }
}
